#pragma once
#include "hashtable.hpp"
namespace xzq1
{
    template <class K, class Hash = OPEN_HASH::_Hash<K>>
    class unordered_set
    {
        struct SetKOfT
        {
            const K &operator()(const K &key)
            {
                return key;
            }
        };

    public:
        typedef typename OPEN_HASH::HashTable<K, K, SetKOfT, Hash>::iterator iterator;
        iterator begin()
        {
            return _ht.begin();
        }
        iterator end()
        {
            return _ht.end();
        }
        pair<iterator, bool> Insert(const K &key)
        {
            return _ht.Insert(key);
        }

    private:
        OPEN_HASH::HashTable<K, K, SetKOfT, Hash> _ht;
    };
    void testset()
    {
        unordered_set<int> s;
        s.Insert(1);
        s.Insert(5);
        s.Insert(4);
        s.Insert(2);
        unordered_set<int>::iterator it = s.begin();
        while (it != s.end())
        {
            cout << *it << " ";
            ++it;
        }
        cout << endl;
    }
}